<!DOCTYPE html>
<html>

	<head>
		<!-- Standard Meta -->
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<!-- Site Properties -->
		<title>${databaseName}</title>
		<link href="https://cdn.bootcss.com/semantic-ui/2.3.0/semantic.min.css" rel="stylesheet">
		<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
		<script src="https://cdn.bootcss.com/semantic-ui/2.3.0/semantic.min.js"></script>
		<!-- Content JS HERE !-->
		<style>
			.last.container {
				margin-bottom: 300px !important;
			}
			
			h1.ui.center.header {
				margin-top: 3em;
			}
			
			h2.ui.center.header {
				margin: 4em 0em 2em;
			}
			
			h3.ui.center.header {
				margin-top: 2em;
				padding: 2em 0em;
			}
			.hide{
				display: none;
			}
		</style>
	</head>

	<body>
		<!-- 目录 -->
		<div class="ui sidebar fixed vertical menu">
			<#list tableInfos as tableInfo>
				<div class="item menu-table-index" data-table-index="${tableInfo_index}">
					<a>
						${tableInfo_index+1}. ${tableInfo.tableName}
					</a>
					<div>
						<b>
							<#if tableInfo.tableRemark?default("")?trim?length gt 1>
								(${tableInfo.tableRemark})
							</#if>
						</b>
					</div>
				</div>
			</#list>

		</div>
		<!--/目录-->

		<div class="pusher">
			<div class="ui launch right fixed button menu-toggle" style="position: fixed">
				<i class="content icon "></i>
			</div>
			<h1 id="top" class="ui center aligned header ">数据库名称：${databaseName}</h1>
			<!--表-->
			<#list tableInfos as tableInfo>
			<div id="db-table-${tableInfo_index}" class="ui container last db-table ">
				<h1 class="ui center aligned header">表名:${tableInfo.tableName}</h3>
				<h3 class="ui center aligned ">注释:${tableInfo.tableRemark}</h3>
				<table class="ui orange celled   table">
					<caption>表格信息</caption>
					<thead>
						<tr>
							<th>字段</th>
							<th>类型</th>
							<th>注释</th>
							<th>键</th>
							<th>能否为空</th>
							<th>默认值</th>
							<th>其他</th>
						</tr>
					</thead>
					<tbody>
						<#list tableInfo.fields as field>
						<tr>
							<td>${field.field}</td>
							<td>${field.type}</td>
							<td>${field.remark}</td>
							<td>${field.key}</td>
							<td>${field.nullAble}</td>
							<td>${field.defaultValue}</td>
							<td>${field.extra}</td>
						</tr>
						</#list>
					</tbody>

				</table>

				<table class="ui orange celled   table">
					<caption>索引信息</caption>
					<thead>
						<tr>
							<th>名称</th>
							<th>栏位</th>
							<th>索引类型</th>
							<th>索引方式</th>
							<th>索引备注</th>
						</tr>
					</thead>
					<tbody>
						<#list tableInfo.keys as key>
						<tr>
							<td>${key.name}</td>
							<td>${key.getColumnCombine()}</td>
							<td>
								<#if key.unique>
									UNIQUE
									<#else>
									NORMAL
								</#if>
							</td>
							<td>${key.indexType}</td>
							<td>${key.indexComment}</td>
						</tr>
						</#list>
					</tbody>

				</table>
			</div>
			</#list>
			<!-- /表 -->
		</div>

		<script type="text/javascript">
            $(function(){
                $('.ui.sidebar').sidebar({

                });

                $(".menu-toggle").click(function(){
                    $('.ui.sidebar').sidebar("toggle");
				});

                $(".menu-table-index").click(function(){
                    var $this = $(this);
                    var tableIndex = $this.data("table-index");
                    location.href = "#db-table-"+tableIndex;
                    $('.ui.sidebar').sidebar("toggle");
				});
            })

			

			
		</script>

	</body>

</html>